
package za.ac.cput.peterjohn.DesignPatternPrincipals.Structural.Adapter.Model;


public class TempretureObjectReporter implements TempretureInfo
{
    CelcuisReporter celsuisReporter;

    public TempretureObjectReporter(CelcuisReporter celsuisReporter) { this.celsuisReporter = celsuisReporter;}
 
    @Override
    public double getTempretureInF() { return celsuisReporter.getTempretureInC(); }
    
    @Override
    public double getTempretureInC() { return cToF(celsuisReporter.getTempretureInC()); }
    
    @Override
    public void setTempretureInC(double tempretureInC) { celsuisReporter.setTempretureInC(tempretureInC); }

    @Override
    public void setTempretureInF(double tempretureInF) { celsuisReporter.setTempretureInC(fToC(tempretureInF)); }

    private double fToC( double f){ return ( (f-32) * 5 / 9);}
    private double cToF( double c){ return ( (c * 9 / 5) +32 );}   
}